package cdu.sl.aichatdemo.pojo.dto;


import lombok.Getter;
import lombok.Setter;

/**
 * 统一页面响应结果
 */
@Getter
@Setter
public class Result {
    /**
     * 响应状态码 使用chrono.com.response.ResponseCode统一定义
     */
    private Integer code;

    private String message;

    private Object data;

    public static Result success() {
        Result result = new Result();
        result.code = 200;
        return result;
    }


    public static Result success(String message) {
        Result result = new Result();
        result.code = 200;
        result.message = message;
        return result;
    }

    public static Result success(String message, Object data) {
        Result result = success(message);
        result.data = data;
        return result;
    }

    public static Result error(Integer code, String message) {
        Result error = new Result();
        error.code = code;
        error.message = message;
        return error;
    }

}
